class SymbolTableEntry():

	def __init__(self,lexeme,currentOffset):
		self.lexeme = lexeme
		self.type = None
		self.offset = currentOffset
		self.special = None
		self.location = ""
		self.temporal = False
		self.nextUse = None
		self.live = False


	def setLexeme(self,lexeme):
		self.lexeme = lexeme

	def getLexeme(self):
		return self.lexeme

	def setType(self,type):
		self.type = type
		self.offset = self.offset + self.type.getSize()

	def setTypeNoOffset(self,type):
		self.type = type

	def getType(self):
		return self.type

	def getOffset(self):
		return self.offset

	def setOffset(self,offset):
		self.offset = offset

	def setAttribute(self):
		self.special = "attribute"

	def isAttribute(self):
		return self.special == "attribute"

	
	def setParam(self):
		self.special = "param"

	def isParam(self):
		return self.special == "param"

	def setTemporal(self):
		self.temporal = True

	def isTemporal(self):
		return self.temporal

	def setLocation(self,location):
		#location: register or memory address
		self.location = location

	def getLocation(self):
		return self.location

	def isAlive(self):
		return self.live

	def setNoLive(self):
		self.live = False
	
	def setLive(self):
		self.live = True

	def setNextUse(self,index):
		self.nextUse = index

	def setNoNextUse(self):
		self.nextUse = None

	def getNextUse(self):
		return self.nextUse

	def showEntry(self):
		if self.offset != None:
			entry = "lexeme:%s type:%s offset:%d special:%s temporal:%s live:%s next_use:%s location:%s"%(self.lexeme,self.type,self.offset,self.special,self.temporal,self.live,str(self.nextUse),self.location)
		else:
			
			entry = "lexeme:%s type:%s special:%s temporal:%s live:%s next_use:%s location:%s"%(self.lexeme,self.type,self.special,self.temporal,self.live,str(self.nextUse),self.location)
		return entry

